package edu.gatech.cs2340.bytebankers.tests;

import static org.junit.Assert.*;

import org.junit.Test;

import edu.gatech.cs2340.bytebankers.model.Journey;
import edu.gatech.cs2340.bytebankers.model.Player;
import edu.gatech.cs2340.bytebankers.presenter.IStartupPresenter;
import edu.gatech.cs2340.bytebankers.presenter.StartupPresenter;
import edu.gatech.cs2340.bytebankers.view.IStartupView;
import edu.gatech.cs2340.bytebankers.view.TestStartupView;

public class StartupTest {

	@Test
	public void testSaveForm() {
		
		Journey journey = new Journey();
		IStartupPresenter presenter = new StartupPresenter(journey);
		IStartupView view = new TestStartupView(presenter);
		presenter.setView(view);
		
		int index = 0;
		
		//ensure we have 5 players
		assertEquals(journey.getPlayers().size(),5);
		
		for (Player player : journey.getPlayers()) {
			if(index == 0) {
				//ensure the leader is the correct name.
				assertEquals(player.getName(),"Test Leader");
			} else {
				//ensure the players are the correct name
				assertEquals(player.getName(),"Test Player " + index);
			}
			index++;
		}
		
		//ensure the money is the correct amount.
		assertEquals(journey.getLeader().getMoneyLeft(), 10000, 0);
		
		//ensure the ration rate is correct.
		assertEquals(journey.getRationRate(), 2);
		
		//ensure the pace is correct.
		assertEquals(journey.getPace(), 10);
	}
}
